<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>时间戳</title>
</head>

<body>
  <script>
    // 时间戳的获取1: getTime()   必须实例化
    const date = new Date()
    console.log(date.getTime());

    // 方式2
    console.log(+new Date());

    // 方式3
    console.log(Date.now());

    // 指定时间的时间戳
    console.log(+new Date('2024-05-03'));


  </script>
</body>

</html>